﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DXApplicationTangche.UC.门店出入库.Service;

namespace DXApplicationTangche.UC.门店出入库.淘宝
{
    public partial class Form淘宝出库 : DevExpress.XtraEditors.XtraForm
    {
        private TagPrintDTO tagPrintDTO = new TagPrintDTO();
        private List<TagPrintDTO> list = new List<TagPrintDTO>();
        public Form淘宝出库()
        {
            InitializeComponent();
        }
        private void textBox扫码_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)
            {
                if (!String.IsNullOrWhiteSpace(this.textBox扫码.Text))
                {
                    try
                    {
                        this.tagPrintDTO = 出入库Service.get成衣ByBarcode(this.textBox扫码.Text.Trim());
                        if (!String.IsNullOrEmpty(this.tagPrintDTO.inventoryNo))
                        {
                            this.list.Add(this.tagPrintDTO);
                        }
                        this.gridControl淘宝出库.DataSource = this.list;
                        this.gridView淘宝出库.RefreshData();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    this.textBox扫码.Clear();
                }
                else
                {
                    MessageBox.Show("请扫码");
                }
            }
        }

        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            if (this.list.Count > 0)
            {
                new Form客户地址(this.list).ShowDialog();
                this.list.Clear();
                this.gridView淘宝出库.RefreshData();
                this.ActiveControl = this.textBox扫码;
            }
            else
            {
                MessageBox.Show("无打印内容");
                this.ActiveControl = this.textBox扫码;
                return;
            }
        }

        private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.list.Remove(this.list[this.gridView淘宝出库.FocusedRowHandle]);
            this.gridControl淘宝出库.DataSource = this.list;
            this.gridView淘宝出库.RefreshData();
        }
    }
    
}